<template>
	<view>
		<article-item :data="article" v-for="article of articles" :key="article.name"></article-item>
	</view>
</template>

<script lang="ts">
	import {
		getAllArticles
	} from "@/service/articles"
	import ArticleItem from "@/components/article-list/article-item.vue"
	import {
		ArticleMeta
	} from "@/models/article"
	export default {
		components: {
			ArticleItem
		},
		data() {
			return {
				articles: [] as ArticleMeta[]
			}
		},
		mounted() {
			uni.request({
				url: `api/ping`,
				method: "GET",
				success: (res) => {
					console.log('ping!!!', res)
					// this.articles = res.data
				},
				fail(err) {
					console.log('ping fail!!!', err)
				}
			});
			getAllArticles().then((resp) => {
				console.log(resp)
				this.articles = resp
			})
			// uni.request({
			// 	url: `static/data/articles/articles.json`,
			// 	method: "GET",
			// 	success: (res) => {
			// 		this.articles = res.data
			// 	}
			// });
		}
	};
</script>

<style>
</style>
